<template>
	<view class="lottie-bg">
	
		<view class="wechat_login">
			<view class="btn-wrapper">
				
				<button hover-class="none" @click="gohome" class="bg-theme btn1">返回首页</button>
				
			</view>
		</view>
	</view>
</template>

<script>

	import dayjs from "@/plugin/dayjs/dayjs.min.js";
	import wechat from "@/libs/wechat";
	import {
		getUserInfo
	} from "@/api/user";
	export default {
		name: "Auth",
		mounted() {

		},
		onLoad(option) {
			
			console.log('option',option)
			let that = this
			const {
				code,
				phone
			} = option;
			console.log('code',code)
			console.log('phone',phone)
			wechat.wxbangauth(code,phone)
				// .then(() => {
				// 	// console.log(decodeURIComponent(decodeURIComponent(option.back_url)),'back_url')
				// 	// const href = decodeURIComponent(decodeURIComponent(option.back_url))
				// 	// location.replace(href)
				// 	this.$util.Tips("绑定成功");
				// 	// uni.navigateTo({
				// 	// 	url:'/pages/index/index'
				// 	// })
				// 	location.replace("/");
				// })
				// .catch((err) => {
				// 	location.replace("/");
					
				// });
		},
		methods: {
			gohome(){
				// wx.miniProgram.navigateTo({
				
				//      url: '/pages/index/index' // 目标页面路径
				
				// });
				this.$wechat.goHome().then(res=>{
					console.log('success');
				})
			},
		}
	};
</script>

<style scoped lang="scss">
	.lottie-bg {
		position: fixed;
		left: 0;
		top: 0;
		background-color: #fff;
		width: 100%;
		height: 100%;
		z-index: 999;

		display: flex;
		align-items: center;
		justify-content: center;
	}

	#lottie {
		display: block;
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		overflow: hidden;
		transform: translate3d(0, 0, 0);
		margin: auto;

		image {
			width: 200rpx;
			height: 200rpx;
		}
	}
	.wechat_login {
		width: 200px;
		margin-top: 96rpx;
		.img image {
			width: 100%;
		}
		.btn-wrapper {
			padding: 0 66rpx;
			button {
				width: 100%;
				height: 86rpx;
				line-height: 86rpx;
				margin-bottom: 40rpx;
				border-radius: 120rpx;
				font-size: 30rpx;
				&.btn1 {
					color: #fff;
					background: #aa55ff;
				}
				&.btn2 {
					color: #666666;
					border: 1px solid #DDDDDD;
				}
			}
		}
	}
	
</style>